<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>Document</title>
	
	<script src="js/jquery.1.9.1.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>


<div class="uploadImg"> 
 <input type="file" id="file" /> 
 <input type="hidden" id="hidImgName" /> 
 <input type="button" id="btnUploadImg" onclick='upload()' value="上传" /> 
 <input type="button" id="btnDeleteImg" value="删除" /> 
</div> 
<hr>
<!-- <form enctype="multipart/form-data" id="uploadForm"> -->
      <!-- <input type='file' name='xxx' id='pic_img'> -->
      <!-- <input type='button' onclick='upload()' value='点击上传'> -->
<!-- </form> -->
<script>
function upload(){
    var formData = new FormData();  //创建一个forData 
	var input = document.getElementById('file');
    formData.append('img', input.files[0]); //把file添加进去  name命名为img
	formData.append('type', 'zcc'); //把type添加进去  zcc命名为type
    $.ajax({
        url: './ajaxupload.php',
        data: formData,
        type: "POST",
        async: false,
        cache: false,
        contentType: false,
        processData: false,
        success: function(data) {
			alert(111);
			console.log(data);
             //成功
        },
        error: function() {
              //失败
        }
      })
}
</script>
</body>
</html>